<%- include('./common/header.html') %>


<h1>笔记列表</h1>
<div class="loginbox">
    <% if(username){ %>
      <%=username%>
      <a href="/logout">退出登录</a>
    <% }else{ %>
        <a href="/login">登录</a>
    <%}%>
</div>
<a href="/add">添加笔记</a>
<table class="table table-hover">
    <% for(let i =0;i<data.length;i++){ %>
    <tr>
        <td  onclick="console.log($)"><%= data[i].title %></td>
        <td><a href="/edit/<%=data[i]._id%>" >编辑</a> <a href="javascript:;" class="deleteBtn" data-id="<%=data[i]._id%>">删除</a></td>
    </tr>
    <% } %>
</table>
<script src="js/list.js" type="module"></script>
<%- include('./common/footer.html')%>